package com.allin.mall.user.service.impl;

import com.allin.mall.user.service.TimerService;
import io.netty.util.HashedWheelTimer;
import io.netty.util.TimerTask;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Service
public class WheelTimerImpl implements TimerService {

    private static final HashedWheelTimer timer = new HashedWheelTimer(1L, TimeUnit.SECONDS, 60);

    @Override
    public void addTimerTask(TimerTask task) {
        timer.newTimeout(task, 120, TimeUnit.SECONDS);
    }
}
